home *** CD-ROM | disk | FTP | other *** search
Text File | 1986-04-03 | 4.5 KB | 221 lines | [TEXT/MEDT] |
- **************************************************************************
- * This macro file is provided as a collection of useful example macros *
- * You need MEdit version 1.2 or later to load this file. *
- * IMPORTANT: TO SPEED UP LOADING REMOVE ALL COMMENTS (lines starting *
- * with an asterik) *
- * Written : 05.01.86 Matthias Aebi *
- * Last modification : 31.03.86 Matthias Aebi *
- **************************************************************************
-
- * 1
- * this macro can be used to get irregulary spaced tabs.
- * write a dot in the first line of the window for every tab stop
- * that you would like to use
- "Tabs" {
- Push;
- Select(0,C.);
- Push;
- Find(".");
- Select(0,C[ | 0,C.);
- Copy;
- Drop;
- Pop;
- Paste;
- Insert(" ");
- };
-
- * for use together with the following macros
- * 2
- "Save current Position/P" {
- push;
- };
-
- * 3
- * jumps back to the last saved position with macro 2
- * the stack can hold the last eight positions
- "Back to Position/B" {
- select(L[,C[)!;
- pop;
- };
-
- * 4
- * moves the current selection to the position / selection
- * previously saved with macro 2
- "Move selection/M" {
- cut;
- pop;
- paste!;
- };
-
- * 5
- * copies the current selection to the position / selection
- * previously saved with macro 2
- "Copy selection/K" {
- copy;
- pop;
- paste!;
- };
-
- * 6
- * draw a line in the menu
- "-" {};
-
- * 7
- * jump to bottom of file
- "Bottom" {
- SELECT(L$,C$)!;
- };
-
- * 8
- * jump to top of file
- "Top" {
- SELECT(0,0)!;
- };
-
- * 9
- * select all lines in the file
- "Select all" {
- SELECT(0,0|L$,C$);
- };
-
- * 10
- * move all lines in the current selection four positions to the left
- * by deleting the leftmost characters. do nothing for empty lines.
- "Move selection left/L" {
- PUSH;
- WHILE L. < L] {
- SELECT(L.,0|L.,4);
- CLEAR;
- SELECT(L.+1,0)!;
- };
- SELECT(L[,0|L],0);
- DROP;
- };
-
- * 11
- * move all lines in the current selection to the right by inserting
- * a tab. do nothing for empty lines.
- "Move selection right/R" {
- PUSH;
- WHILE L. < L] {
-
- SELECT(L.,0);
- IF NOT C$ = 0 {
- INSERT("\t");
- };
- SELECT(L.+1,0)!;
- };
- SELECT(L[,0|L],0);
- DROP;
- };
-
- * 12
- * ask for a line number to jump to and do it
- "Jump to Line/J" {
- prompt("Goto Line",#0);
- select(#0-1,0|#0-1,C$)!;
- };
-
- * 13
- * replace the shortcut to the left of the cursor position with
- * the appropriate string. to define shortcuts write them at the
- * top of the window followed by the string to insert. use one line for
- * each shortcut. separate string and shortcut by a blank.
- * examples: (define them without an asterik at the start of the window)
- * ilm I like Macintosh
- * gb Good bye
- *
- * if you type 'ilm' and then press command-g this will replace
- * 'ilm' with 'I like Macintosh'. 'gb' will be replaced by 'Good bye'
- "Glossary/G" {
- Select(L.,C<|L.,C.);
- Push;
- Set($0,$S);
- Select(0,0);
- Find($0);
-
- If L. < L[ And C. = 0{
- Select(L.,C:+1|L.,C$);
- Copy;
- Pop;
- Paste;
- }
- Else {
- Pop;
- Select(L:,C:);
- };
- };
-
- * 14
- * scroll one screen down
- * if you have a Mac+ or a numeric keypad you may use shift-cursor-down
- "Page Down/D" 272 {
- * get screen height
- Set(#9, L>-L<-1);
- Select(L>+#9,C.)!;
- };
-
- * 15
- * scroll one screen up
- * if you have a Mac+ or a numeric keypad you may use shift-cursor-up
- "Page Up/U" 277 {
- * get screen height
- Set(#9, L>-L<-1);
- Select(L<-#9,C.)!;
- };
-
- * 16
- * replace all 'real' tabs by blank strings
- * this is useful to convert 'Edit'- to 'MEdit'-files
- "Replace tabs" {
- SELECT(0,0)!;
- FIND("\9");
- WHILE NOT L. = 0 OR NOT C. = 0 {
- INSERT("\t");
- FIND("\9");
- };
- };
-
- "-" {};
-
- * the numbers define cursor keys on a Mac Plus / num Keypad
- "Cursor Up/2" 177 {
- SELECT(L.-1,C.)!;
- };
-
- "Cursor Down/A" 172 {
- SELECT(L.+1,C.)!;
- };
-
- "Cursor Right/W" 166 {
- SELECT(L.,C.+1)!;
- IF C. = C$ {
- SELECT(L.+1,0)!;
- };
- };
-
- "Cursor Left/Q" 170 {
- SELECT(L.,C.-1)!;
- IF C. = 0 {
- SELECT(L.-1,0);
- SELECT(L.,C$);
- };
- };
-
- * this macro could be used to
- * redefinie shift-BS to 'delete to end of line' instead of 'delete right char'
- *251 {
- * Select(L.,C.|L.,C$);
- * Clear;
- *};
-
- * swaps the to characters just before the current position
- * this macro is invoked by pressing option-BS. It has no menu entry
- 351 {
- SELECT(L.,C.-1|L.,C.);
- CUT;
- SELECT(L.,C.-1);
- PASTE;
- SELECT(L.,C.+1);
- }.
-